use "C:\Users\sujeo\Dropbox\Blame avoidance and IMF\RIO_scapegoat_replication files\RIO_Scapegoat_maindataset.dta", replace

####################### Table 2: Main results ###############################

eststo clear

## reliance on international financing ##
xtset ccode 

eststo: feologit defend external_debtofgdp change_yield log_loan_quota signatory   Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)


## domestic political contestation ##
eststo: feologit defend total_binding left_gov dayssinceprogram signatory  Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)

## altogether ##

eststo: feologit defend external_debtofgdp change_yield log_loan_quota  total_binding left_gov dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)


esttab using results240509_maintable.rtf, replace se  star(* .10 ** .05 *** .01)




###################### Table 3: Main Logit Results  #####################

eststo clear
xtset ccode


eststo: clogit blame_bin external_debtofgdp log_loan_quota change_yield total_binding left_gov dayssinceprogram signatory lag_gov_pop Past_IMFparticipation election gdp_growth unemployment countimfsalience, group(ccode) cluster(ccode)

eststo: clogit defend_bin external_debtofgdp log_loan_quota change_yield total_binding left_gov dayssinceprogram signatory lag_gov_pop Past_IMFparticipation election gdp_growth unemployment countimfsalience, group(ccode) cluster(ccode)

eststo: clogit neutral external_debtofgdp log_loan_quota change_yield total_binding left_gov dayssinceprogram signatory lag_gov_pop Past_IMFparticipation election gdp_growth unemployment countimfsalience, group(ccode) cluster(ccode)


esttab using blamedefend_20240509.rtf, replace se  star(* .10 ** .05 *** .01)



#############################APPENDIX #################

#### Summary statistics #####

estpost  sum blame_bin defend_bin neutral left_gov log_loan_quota change_yield external_debtofgdp  fp_qpc  total_binding  dayssinceprogram signatory lag_gov_pop Past_IMFparticipation prior10yr_imf election gdp_growth  countimfsalience  

esttab, cells("count mean sd min max")

####### Robustness checks #########
### Table A4. Interacting international factors with domestic factors ###


eststo clear
xtset ccode

eststo: feologit defend i.left_gov##c.external_debt change_yield log_loan_quota  total_binding dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend  c.external_debt##c.total_binding  left_gov change_yield log_loan_quota dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend  c.external_debt##c.dayssinceprogram total_binding  left_gov change_yield log_loan_quota  signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend i.left_gov##c.log_loan_quota external_debt change_yield log_loan_quota  total_binding dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend  c.log_loan_quota##c.total_binding external_debt left_gov change_yield log_loan_quota dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend external_debt c.log_loan_quota##c.dayssinceprogram total_binding  left_gov change_yield log_loan_quota  signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend i.left_gov##c.change_yield external_debt change_yield log_loan_quota  total_binding dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)


eststo: feologit defend log_loan_quota c.change_yield##c.total_binding external_debt left_gov change_yield log_loan_quota dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend external_debt c.log_loan_quota c.change_yield##c.dayssinceprogram total_binding  left_gov change_yield log_loan_quota  signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

esttab using interaction_model20250326.rtf, replace se  star(* .10 ** .05 *** .01)



feologit defend i.left_gov##c.external_debt change_yield log_loan_quota  total_binding dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(left_gov) at(external=(10(100)930)) level(90)
marginsplot, title("Effect of Left-wing gov't on Defending with 90% CI") 


feologit defend  c.external_debt##c.total_binding  left_gov change_yield log_loan_quota dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(total_binding) at(exter=(10(100)930)) level(90)
marginsplot,  title("Effect of additional IMF conditions on Defending with 90% CI") 



feologit defend  c.external_debt##c.dayssinceprogram total_binding  left_gov change_yield log_loan_quota  signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(dayssinceprogram) at(exter=(10(100)930)) level(90)
marginsplot,  title("Effect of additional day spent on Defending with 90% CI") 




feologit defend i.left_gov##c.log_loan_quota external_debt change_yield log_loan_quota  total_binding dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(left_gov) at(log_loan_quota=(5.9(0.3)8)) level(90)
marginsplot, xtitle("(log) IMF loan (% quota)")  title("Effect of Left-wing gov't on Defending with 90% CI")

feologit defend  c.log_loan_quota##c.total_binding external_debt left_gov change_yield log_loan_quota dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(total_binding) at(log_loan_quota=(5.9(0.3)8)) level(90)
marginsplot,  xtitle("(log) IMF loan (% quota)")  title("Effect of additional IMF condition on Defending with 90% CI")



feologit defend external_debt c.log_loan_quota##c.dayssinceprogram total_binding  left_gov change_yield log_loan_quota  signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(dayssinceprogram) at(log_loan_quota=(5.9(0.3)8)) level(90)
marginsplot,  xtitle("(log) IMF loan (% quota)")  title("Effect of additional day spent on Defending with 90% CI")

feologit defend i.left_gov##c.change_yield external_debt change_yield log_loan_quota  total_binding dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(left_gov) at(change_yield=(-.33(0.05).55)) level(90)
marginsplot,  xtitle(" Change in sovereign bond yield (%)")  title("Effect of Left-wing gov't on Defending with 90% CI")

feologit defend log_loan_quota c.change_yield##c.total_binding external_debt left_gov change_yield log_loan_quota dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(total_binding) at(change_yield=(-.33(0.05).55)) level(90)
marginsplot,  xtitle(" Change in sovereign bond yield (%)")  title("Effect of additional IMF condition on Defending with 90% CI")


feologit defend external_debt c.log_loan_quota c.change_yield##c.dayssinceprogram total_binding  left_gov change_yield log_loan_quota  signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)
margins, dydx(dayssinceprogram) at(change_yield=(-.33(0.05).55)) level(90)
marginsplot,  xtitle(" Change in sovereign bond yield (%)")  title("Effect of additional day spent on Defending with 90% CI")



### Table A4.2 Robustness Checks: Two-level game & fiscal conditions & US diff###

eststo clear
xtset ccode 

gen before_program=1 if dayssinceprogram<1
replace before_program=0 if dayssinceprogram>0

eststo: feologit defend external_debtofgdp change_yield log_loan_quota  total_binding left_gov dayssinceprogram signatory Past_IMFparticipation election gdp_growth unemployment  countimfsalience  before_program, cl(ccode)

eststo: feologit defend external_debtofgdp change_yield log_loan_quota  fp_qpc  left_gov dayssinceprogram signatory Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)

eststo: feologit defend external_debtofgdp log_loan_quota change_yield left_gov  dayssinceprogram signatory Past_IMFparticipation election  gdp_growth unemployment  countimfsalience idealpointdistance, cl(ccode)

esttab using blame-defend_20240503.rtf, replace se  star(* .10 ** .05 *** .01)





##### Table A4.3 Outside Option from Clark (2022) #####
eststo clear
gen oo=0
replace oo=1 if countryx=="Ecuador"
replace oo=1 if countryx=="South Korea" & year>1999

xtset ccode 

eststo: feologit defend external_debtofgdp change_yield log_loan_quota signatory  oo Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)


eststo: feologit defend oo total_binding left_gov dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

eststo: feologit defend c.external_debtofgdp##oo change_yield log_loan_quota total_binding left_gov dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

esttab using oo_20250326.rtf, replace se  star(* .10 ** .05 *** .01)




### Table A4.4 Populism & Neoliberalism ###

gen pop=0
replace pop=1 if leaderx=="A. Tsipras"
replace pop=1 if leaderx=="Kirchner"

gen neoliberal=0
replace neoliberal=1 if leaderx=="A. Samaras"
replace neoliberal=1 if leaderx=="L. Papademos"


xtset ccode 
eststo clear

# pop- international cooperation #
eststo: feologit defend external_debtofgdp change_yield log_loan_quota signatory pop  Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)


## pop- domestic political contestation ##
eststo: feologit defend total_binding left_gov dayssinceprogram pop signatory  Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)

# neo - internationl cooperation #
eststo: feologit defend external_debtofgdp change_yield log_loan_quota signatory neoliberal  Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)


# neo - domestic political contestation #
eststo: feologit defend total_binding left_gov dayssinceprogram neoliberal signatory  Past_IMFparticipation election gdp_growth unemployment countimfsalience, cl(ccode)


esttab using pp_neoliberal20250326.rtf, replace se  star(* .10 ** .05 *** .01)


### Table A4.5 leader fixed effect ###
encode leaderx, gen(leaderx_n)
xtset leaderx_n

eststo clear
eststo: feologit defend external_debtofgdp log_loan_quota change_yield total_binding left_gov dayssinceprogram signatory  lag_gov_pop  Past_IMFparticipation election   countimfsalience, cl(leaderx_n)


esttab using results240506_leader.rtf, replace se  star(* .10 ** .05 *** .01)



### Table A4.6 Robustness check: govt domestic political standing###
eststo clear
xtset ccode 

eststo: feologit defend external_debtofgdp change_yield log_loan_quota  total_binding left_gov dayssinceprogram signatory Past_IMFparticipation election lag_gov_pop countimfsalience, cl(ccode)



## Interacting with gov popularity with dom. political variabels  ##


eststo: feologit defend c.external_debtofgdp change_yield c.log_loan_quota  c.total_binding##c.lag_gov_pop left_gov dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

margins, dydx(total_binding) at(lag_gov_pop=(0(20)100))
marginsplot, xtitle("Government approval ratings") ytitle("") title("Effect of an additional IMF condition on defending statements")  xlabel(, alternate) recastci(rarea) yline(0) scheme(sj) level(90)



eststo: feologit defend c.external_debtofgdp change_yield c.log_loan_quota  c.total_binding left_gov##c.lag_gov_pop dayssinceprogram signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

margins, dydx(left_gov) at(lag_gov_pop=(0(20)100))
marginsplot, xtitle("Government approval ratings") ytitle("") title("Effect of left-wing government on defending statements")  xlabel(, alternate) recastci(rarea) yline(0) scheme(sj) level(90)


eststo: feologit defend c.external_debtofgdp change_yield c.log_loan_quota  c.total_binding left_gov c.dayssinceprogram##c.lag_gov_pop signatory gdp_growth unemployment Past_IMFparticipation election countimfsalience, cl(ccode)

margins, dydx(dayssinceprogram) at(lag_gov_pop=(0(20)100))
marginsplot, xtitle("Government approval ratings") ytitle("") title("Effect of programs age (days) on defending statements")  xlabel(, alternate) recastci(rarea) yline(0) scheme(sj) level(90)


esttab using lag_gov_pop_20250328.rtf, replace se  star(* .10 ** .05 *** .01)































 
